#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define NUMBER	500000
#define FORZ(i, max)	for(i = 0; i < max; i++)
#define SUM(n) ((n)*((n)+1ll)/2ll)
#define MXK 9

typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned int uint;

int main() {
//	uint a,k,i,m;
	ull n,a,k,i,m;
	//scanf("%d %d",&k,&a);
	printf("unsigned char *T[2][9]={\n");
	for(a = 2; a <=3; a++)
	{
		printf("{");
		for(k = 1; k <= MXK; k++) {
			printf("//a=%d k=%d\n",a,k);
			printf("\"");
			m = pow10(k);
			for(n=0;n<=m;n+=1) {
				//printf("%llu\n",n);
				if( (((n*n)%m)*(a==3?n:1)) % m == n)
					printf((n==0)?"%llu":" %llu",n);
			}
			printf((k==MXK)?"\"":"\",");
		}
		printf((a==3)?"}\n":"},\n");
	}
	printf("}\n");
	return 0;
}
